package com.hdd.art.biz.login.controller;

import com.hdd.art.biz.login.dto.WXRegisterRequest;
import com.hdd.art.biz.login.service.impl.RegisterService;
import com.hdd.art.dto.AppResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;

/**
 * 作者： fangzehua
 * 时间： 2021/6/19 15:04
 *
 * @Version: 1.0
 * @Desc 类描述信息
 */
@RestController
@RequestMapping("/")
@Api(value = "微信注册",tags = {"微信注册"})
public class LoginController {

    @Autowired
    private RegisterService registerService;

    @PostMapping("/getInfoByOpenId")
    @ApiOperation(value = "根据OpendId获取用户信息" ,notes = "")
    public AppResponse info(@Valid @RequestBody WXRegisterRequest request ){
        return registerService.getOpenId(request);
    }

    @PostMapping("")
    @ApiOperation(value = "微信授权登录" ,notes = "")
    public AppResponse register(@Valid @RequestBody WXRegisterRequest request ){
        return registerService.register(request);
    }


}
